<?php
header('Content-Type:text/html;Charset=UTF-8');

@$name = $_REQUEST['name'];

@$age = $_REQUEST['age'];

@$contact = $_REQUEST['contact'];

@$address = $_REQUEST['address'];

@$img = $_FILES['img'];

$message="";

if($img['error']!=0){
	$message="照片上传出错！";
	include "Alterinfo.php";
	die;
}
$flag = move_uploaded_file($img['tmp_name'],'img/'.$img['name']);

if(!$flag){
	$message="照片上传失败！";
	include "Alterinfo.php";
	die;
}

require 'lib/db.php';

@$flag = dbUpdate("update worker set name=:name,age=:age,contact=:contact,address=:address,img=:img",array('name'=>$name,'age'=>$age,'contact'=>$contact,'address'=>$address,'img'=>$img['name']));

if ($flag==false){
	$message="更新失败！";
	include "Alterinfo.php";
	die;
}
